When a host device writes data to and reads data from a storage device, the host writes and reads data in terms of logical block addresses (LBAs). The basic unit of data transfer between the host and storage device is referred to herein as a “sector.” By “basic unit” it is meant that this is the minimum size of data transfer for a read or write command. A request to read or write is thus a request to read or write some integer number of sectors. The size of a sector may vary from one implementation to the next, but one example of a sector size is 512 bytes. Note that the term “sector” as used herein does not refer to a physical sector on a hard disk drive, or the like. Also note that each LBA corresponds to a sector.
The storage device typically has a memory controller, which translates the LBAs to physical addresses of memory cells on the storage device. As one example, a flash memory device has a Flash Transfer Layer (FTL) or Media Management Layer (MML) that performs a logical address to physical address translation.
Prior to writing data to the memory cells, the memory controller typically forms a codeword from the data from the host. The codeword includes the host data and one or more parity bits. The number of parity bits may vary, depending on the strength of the error correction. The codeword is referred to herein as an “ECC page.” An ECC page is formed from one or more sectors of host data. As one example, an ECC page may be formed from four sectors of host data. Thus, if sector size is 512 Bytes, an ECC page might contain 2K bytes of host data, plus parity bits. An ECC page is a unit of programming in the storage device.
The memory controller has a minimum addressable unit, which is typically one or more ECC pages. Thus, the minimum addressable unit corresponds to some number of sectors. Herein, the term “fragment” is used herein to refer to the minimal addressable unit of memory in the storage device. As one example, if the minimum addressable unit is two ECC pages, then the minimum addressable unit is 4 kB (assuming 512 Byte sector and four sectors per ECC page).
Herein, an aligned write is defined as one in which the start LBA and data size is a multiple of the number of sectors in the fragment. For example, if there are eight sectors in a fragment, then an aligned write has a start LBA that is a multiple of eight and data size that is a integer multiple of eight sectors.
Herein, a write that is not an aligned write is referred to as an unaligned write. Thus, an unaligned write either: 1) has a start LBA that is not a multiple of the number of sectors in the fragment; or 2) has a data size that is not a multiple of the number of sectors in the fragment.
When a host sends an aligned write command, the data can simply be written to the memory die as one or more fragments. However, when a host sends an unaligned write command, the memory controller needs to pre-pad and/or post-pad data the host data to form “aligned data.” By aligned data it is meant that a complete fragment is formed. The memory controller may need to read the pre-pad and/or post-pad data from memory cells. Thus, the memory controller may need to perform a read-modify-write. A read-modify-write refers to reading in pre-pad and/or post-pad data from memory cells on the memory die, forming a fragment of aligned data, and writing the fragment of aligned data to the memory die.
Performing read-modify-writes can be quite time consuming. Moreover, performing read-modify-writes can increase write amplification. Write amplification means that the amount of data actually written to the storage device is more than the amount of host data to be written. Write amplification can reduce the lifespan of the storage device.